<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

	<head>
		<title>添加商品</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/style.css" />
		<script>
			function checkName(){
				var cName = document.getElementById("cName");
				var f1 = document.getElementById("f1");
				if(cName.value != null && cName.value != ""){
					f1.innerHTML="√";
					f1.style="color:green";
					return true;
				}else{
					f1.innerHTML="×";
					f1.style="color:red";
					return false;
				}
			}
			function checkPrice(){
				var cPrice = document.getElementById("cPrice");
				var f2 = document.getElementById("f2");
				if(cPrice.value != 0){
					f2.innerHTML="√";
					f2.style="color:green";
					return true;
				}else{
					f2.innerHTML="×";
					f2.style="color:red";
					return false;
				}
			}
			function checkAccount(){
				var cAccount = document.getElementById("cAccount");
				var f3 = document.getElementById("f3");
				if(cAccount.value != 0){
					f3.innerHTML="√";
					f3.style="color:green";
					return true;
				}else{
					f3.innerHTML="×";
					f3.style="color:red";
					return false;
				}
			}
			function test(){
				var checkN = checkName();
				var checkP = checkPrice();
				var checkA  = checkAccount();
				return checkA&&checkN&&checkP;
			}
		</script>
	</head>

	<body>
		<div id="wrap">
			<div id="top_content">
				<div id="header">
					<div id="rightheader">
						
					</div>
					<div id="topheader">
						<h1 id="title">
								<a href="#">商品管理</a>
							</h1>
					</div>
					<div id="navigation">
					</div>
				</div>
				<div id="content">
					<p id="whereami">
					</p>
					<h1>
						添加商品:
					</h1>
					<form action="${pageContext.request.contextPath }/pro/addProduct" method="post" onsubmit="return test()">
						<table cellpadding="0" cellspacing="0" border="0" class="form_table">
							<tr>
								<td valign="middle" align="right">
									商品名:
								</td>
								<td valign="middle" align="left">
									<input type="text" class="inputgri" name="product.name" id="cName" onblur="checkName()"/>
									<font id="f1"></font>
								</td>
							</tr>
							<tr>
								<td valign="middle" align="right">
									价格:
								</td>
								<td valign="middle" align="left">
									<input type="text" class="inputgri" name="product.price" id="cPrice" onblur="checkPrice()" />(￥)
									<font id="f2"></font>
								</td>
							</tr>
							<tr>
								<td valign="middle" align="right">
									库存:
								</td>
								<td valign="middle" align="left">
									<input type="text" class="inputgri" name="product.account" id="cAccount" onblur="checkAccount()" />(个)
									<font id="f3"></font>
								</td>
							</tr>
							<tr>
								<td valign="middle" align="right">
									商品描述:
								</td>
								<td valign="middle" align="left">
									<textarea rows="4" cols="30" class="inputgri" name="product.description" tabindex="0"></textarea>
								</td>
							</tr>
						</table>
						<p>
							<input type="submit" class="button" value="确认" />
						</p>
					</form>
				</div>
			</div>
			<div id="footer">
				<div id="footer_bg">
					www.zparkhr.com.cn
				</div>
			</div>
		</div>
	</body>

</html>